<?php
namespace app\index\controller;
use think\Loader;
class Request extends Base{



    //咨询提问
    public function consultQuiz(){
        $consult_type_id          = trim(input('consult_type_id'));
        $details                  = trim(input('details'));
        $ct_title                 = trim(input('ct_title'));
        $invoking                 = Loader::model('Clonsul','service');
        $response                 = $invoking->consultQuizApi($consult_type_id,$ct_title,$details);
        return json($response);
    }

    //咨询回复
    public function  counsultReply(){
        $consult_id               = trim(input('consult_id'));
        $cr_state                 = trim(input('state'));
        $details                  = trim(input('details'));
        $invoking                 = Loader::model('Clonsul','service');
        $response                 = $invoking->counsultReplyApi($consult_id,$cr_state,$details);
        return json($response);
    }

    //咨询收藏
    public function counsultCollect(){
        $consult_id               = trim(input('consult_id'));
        $invoking                 = Loader::model('Clonsul','service');
        $response                 = $invoking->counsultCollectApi($consult_id,1);
        return json($response);
    }

    //新闻评论
    public function newsComment(){
        $news_id                  = trim(input('news_id'));
        $content                  = trim(input('content'));
        $invoking                 = Loader::model('Clonsul','service');
        $response                 = $invoking->newsCommentApi($news_id,$content);
        return json($response);
    }


    //订单生成
    public function orderCreate(){
        $type_id = input('type_id');
        $content = input('content');
        $invoking                 = Loader::model('Order','service');
        $response                 = $invoking->orderCreateApi($type_id,$content);
        return json($response);
    }


    //订单支付
    public function orderPay(){
        $o_no     = input('o_no');
        $pay_type = input('pay_type');
        $invoking                 = Loader::model('Pay','service');
        $response                 = $invoking->orderPayApi($o_no,$pay_type);
        return json($response);
    }

    //查询订单是否支付成功
    public function orderState(){
        $o_no     = input('o_no');
        $invoking                 = Loader::model('Order','service');
        $response                 = $invoking->orderStateApi($o_no);
        return json($response);
    }

    //顾问卡 服务订单提交
    public function serveOrderPresent(){
        /*$content       = input('content');

        $co_age_limit  = input('co_age_limit');*/

        $type_id       = trim(input('type_id'));
        $invoking                 = Loader::model('Order','service');
        $response                 = $invoking->serveOrderPresentApi($type_id);
        return json($response);
    }

    //新闻收藏与取消收藏
    public function newsCollect(){
        $nid = input('news_id');
        $invoking                 = Loader::model('Clonsul','service');
        $response                 = $invoking->counsultCollectApi($nid,2);
        return json($response);
    }

    //新闻收藏-删除
    public function newsDelete(){
        $nid = input('nid');
        $invoking                 = Loader::model('User','service');
        $response                 = $invoking->newsDeleteApi($nid);
        return json($response);
    }

    //我的密码修改
    public function userPasswordAlter(){
        $password       = trim(input('password'));
        $new_password   = trim(input('new_password'));
        $affirm_password   = trim(input('affirm_password'));
        $invoking          = Loader::model('User','service');
        $response                 = $invoking->userPasswordAlterApi($password,$new_password,$affirm_password);
        return json($response);
    }

    //订单取消
    public function userOrderCancel(){
        $o_no = input('o_no');
        $type = input('type');
        $invoking                 = Loader::model('Order','service');
        $response                 = $invoking->userOrderCancelApi($o_no,$type);
        return json($response);
    }

    //用户头像修改
    public function userImg(){
        $file = request()->file("file");
        $invoking                 = Loader::model('User','service');
        $response                 = $invoking->userImgApi($file);
        return json($response);
    }

    //用户昵修改
    public function userName(){
        $name = input('name');
        $invoking                 = Loader::model('User','service');
        $response                 = $invoking->userNameApi($name);
        return json($response);
    }


    //用户昵修改
    public function userMail(){
        $mail = input('mail');
        $invoking                 = Loader::model('User','service');
        $response                 = $invoking->userMailApi($mail);
        return json($response);
    }
}
